export const blscOption = () => {
    let option = {
        color: ['#1f525b'],
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '0',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            splitLine: { show: false },
            axisLabel: {
                show: true,
                // rotate:,
                color: "#fff"
            },
            axisLine: {
                show: true,
                lineStyle: {
                    // color:"#fff"
                }
            },
            data: ['0-1小时', '1-4小时', '4-12小时', '12-24', '24小时以上'],
            axisTick: {
                alignWithLabel: true
            }
        }
        ,
        yAxis: {
            type: 'value',
            position: "left",
            axisLine: {
                show: true,
                lineStyle: {
                    // color:"#fff"
                }
            },
            splitLine: { show: false },
            axisLabel: {
                show: false,
                color: "#fff"
            }
        }
        ,
        series: [
            {
                name: '办理时长',
                type: 'bar',
                barWidth: '50%',
                label: {
                    normal: {
                        show: true,
                        position: 'top',
                        color: "#fff"

                    }
                },
                data: []
            }
        ]
    };
    return option;
}

export const sjsbOption = () => {
    let option = {
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: [],
            textStyle: {
                color: "#fff"
            },
        },
        grid: {
            left: '0',
            right: '1%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
            axisLine: {
                lineStyle: {
                    // color:"#0d1d24"
                },
            },
            axisLabel: {
                rotate: 45,
                color: "#aaa"
            },
        },
        yAxis: {
            type: 'value',
            splitLine: {
                lineStyle: {
                    color: ['#3b444b']
                },
            },
            axisLabel: {
                rotate: 45,
                color: "#aaa"
            },
        },
        series: [
            {
                name:'咨询求助',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'意见建议',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'投诉举报',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'表彰表扬',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'市容环境',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'宣传广告',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'施工管理',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'街面秩序',
                type:'line',
                stack: '总量',
                data:[]
            },
        ]
    };
    return option;
}

export const sjslOption = () => {
    let option = {
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: [],
            textStyle: {
                color: "#fff"
            },
        },
        grid: {
            left: '0',
            right: '1%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
            axisLine: {
                lineStyle: {
                    // color:"#0d1d24"
                },
            },
            axisLabel: {
                rotate: 45,
                color: "#aaa"
            },
        },
        yAxis: {
            type: 'value',
            splitLine: {
                lineStyle: {
                    color: ['#3b444b']
                },
            },
            axisLabel: {
                rotate: 45,
                color: "#aaa"
            },
        },
        series: [
            {
                name:'咨询求助',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'意见建议',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'投诉举报',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'表彰表扬',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'市容环境',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'宣传广告',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'施工管理',
                type:'line',
                stack: '总量',
                data:[]
            },
            {
                name:'街面秩序',
                type:'line',
                stack: '总量',
                data:[]
            },
        ]
    };
    return option;
}

export const patsOption = (d, chart) => {
    var data = [
        {x: 1,y: 85,z: "5",name: '85',country: '1月'},
        {x: 2,y: 72.9,z: 10,name: '72.9',country: '2月'},
        {x: 3,y: 81.5,z: 12,name: '81.5',country: '3月'},
        {x: 4,y: 82.5,z: "-5",name: '82.5',country: '4月'},
        {x: 5,y: 86.1,z: "-20",name: '86.1',country: '5月'},
        {x: 6,y: 80.1,z: 3,name: '80.1',country: '6月'},
        {x: 7,y: 88.5,z: 5,name: '88.5',country: '7月'},
        {x: 8,y: 83.1,z: "-2",name: '83.1',country: '8月'},
        {x: 9,y: 73.2,z: "-3",name: '73.2',country: '9月'},
        {x: 10,y: 77.6,z: 20,name: '77.6',country: '10月'},
        {x: 11,y: 70,z: 1,name: '70',country: '11月'},
        {x: 12,y: 86.4,z: 12,name: '86.4',country: '12月'},
    ];
    if(!chart){
        chart = new G2.Chart({
            container: 'patsStat',
            forceFit: true,
            height: 160,
            padding: [10, 20, 30, 80],
            plotBackground: {
                stroke: '#ccc', // 边颜色
                lineWidth: 1 // 边框粗细
            } // 绘图区域背景设置
        });
    }
    chart.source(data, {
        x: {
            alias: '月份', // 定义别名
            tickInterval: 1, // 自定义刻度间距
            nice: false, // 不对最大最小值优化
            max: 13, // 自定义最大值
            min: 0 // 自定义最小是
        },
        y: {
            alias: '平安指数',
            tickInterval: 5,
            nice: false,
            max: 90,
            min: 70
        },
        z: {
            alias: '标准差',
            show:false,
        }
    });
    // 开始配置坐标轴
    chart.axis('x', {
        title: {
            offset: 50
        },
        label: {
            textStyle:{
                fill:"#fff",
            },
            formatter: function formatter(val) {
                if(val>0 && val<13){
                    return val + '月'; // 格式化坐标轴显示文本
                }
            }
        },
        // plotLines: [{
		// 	color: 'black',
		// 	dashStyle: 'dot',
		// 	width: 2,
		// 	value: 65,
		// 	label: {
        //         rotation: 0,
        //         x:-20,
		// 		style: {
		// 			fontStyle: 'italic'
		// 		},
		// 		text: '月份'
		// 	},
		// 	zIndex: 3
		// }]
        grid: {
            lineStyle: {
                stroke: '#d9d9d9',
                show:false,
                lineWidth: 1,
            }
        }
    });
    chart.axis('y', {
        title: {
            offset: 50
        },
        grid:null,
        label: {
            textStyle:{
                fill:"#fff",
            },
            formatter: function formatter(val) {
                if (val > 0) {
                    return val + '';
                }
            }
        }
    });
    chart.legend(false);
    chart.tooltip({
        title: 'country'
    });
    chart.point().position('x*y').color('#35cfce').size('z', [10, 15]).label('name*country', {
        offset: 0, // 文本距离图形的距离
        textStyle: {
            fill: '#fff'
        }
    }).opacity(.6).shape('circle').tooltip('x*y*z').style({
        lineWidth: 1,
        stroke: '#35cfce'
    });

    chart.guide().line({
        top: true,
        start: ['min', 80],
        end: ['max', 80],
        lineStyle: {
            stroke: '#fff', // 线的颜色
            lineDash: [ 3, 3 ], // 虚线的设置
            lineWidth: 1 // 线的宽度
        }, 
        text: {
            position: 'end',
            content:"平安指数80",
            style: {
                fill:"#ccc",
                textAlign: 'end',
            },
            offsetX:-10,
            offsetY:20,

        },
    });
    chart.render();
    return chart;
}